package com.thinking.stormStudy;

import org.apache.storm.Config;
import org.apache.storm.LocalCluster;
import org.apache.storm.StormSubmitter;
import org.apache.storm.topology.TopologyBuilder;

public class ExclamationTopolagy  {
	
	
	public static void main(String[] args) throws Exception {
		TopologyBuilder builder=new TopologyBuilder();
		
		builder.setSpout("word",new TestWordSpout(),10);
		builder.setBolt("exclaim1", new ExclamationBolt(), 3).shuffleGrouping("word");
	//	builder.setBolt("exclaim2", new ExclamationBolt(), 2).shuffleGrouping("exclaim1");
		 
		  Config  config=new Config();
		 //   config.setDebug(true);
		    
		    
		    
		    if(args!=null&&args.length>=1){
		    	config.setNumWorkers(3);
		    	StormSubmitter.submitTopology(args[0], config,builder.createTopology());
		    	
		    }else{
		    	LocalCluster cluster=new LocalCluster();
		    	cluster.submitTopology("test",config,builder.createTopology());
		    	//org.apache.storm.utils.Utils.sleep(10000);
		    //	cluster.killTopology("test");
		    //	cluster.shutdown();
		    }
		
		
		
		
	}
	

}
